package com.sskj.ffex.p.activity;

import com.lzy.okgo.OkGo;
import com.lzy.okgo.model.Response;
import com.sskj.ffex.m.HttpConfig;
import com.sskj.ffex.m.bean.HttpData;
import com.sskj.ffex.m.bean.Notice;
import com.sskj.ffex.m.http.JsonCallBack;
import com.sskj.ffex.p.base.BasePresenter;
import com.sskj.ffex.v.activity.WebViewActivity;

/**
 * Created by Administrator on 2018/4/16.
 */

public class NoticeDetailPresenter  extends BasePresenter<WebViewActivity>{
    public void getData(String id){
        OkGo.<HttpData<Notice>>post(HttpConfig.BASE_URL+HttpConfig.NOTICEDETAIL)
                .params("id",id)
                .execute(new JsonCallBack<HttpData<Notice>>(this) {
                    @Override
                    public void _onSuccess(Response<HttpData<Notice>> response) {
                        mView.loadData(response.body().getData());
                    }
                });

    }

    public void getAgree(String id){
        OkGo.<HttpData<String>>get(HttpConfig.BASE_URL+HttpConfig.AGREE)
                .params("type",id)
                .execute(new JsonCallBack<HttpData<String>>(this) {
                    @Override
                    public void _onSuccess(Response<HttpData<String>> response) {
                        mView.loadData(response.body().getData());
                    }
                });

    }


}
